import Qt 4.7
Item {
     id: logView
     width: screenWidth; height: screenHeight

     property bool loading: feedModel.status == XmlListModel.Loading

     Behavior on x { PropertyAnimation {} }

     Rectangle {
         anchors.fill: parent
         opacity: 1.0
         color: heiaDarkGrey
         border.width: heiaBorderWidth
         border.color: heiaLightGrey
         radius: heiaBorderWidth
     }

     XmlListModel {
         id: feedModel
         source: "http://www.heiaheia.com/users/" + appItem.userId + "/feed"
         query: "/rss/channel/item"

         XmlRole { name: "title"; query: "title/string()" }
         XmlRole { name: "description"; query: "description/string()" }
         XmlRole { name: "pubDate"; query: "pubDate/string()" }
         XmlRole { name: "author"; query: "author/string()" }
     }

     ListView {        
         id: list
         anchors.fill: parent
         model: feedModel
         delegate: feed
         spacing: 10
         header: Item { height:  10 }
     }

     Component {
         id: feed
          Rectangle {
              id: listItem
              x: 10; y: 10
              height: content.height
              width: logView.width - 20
              border.width: 2
              border.color: heiaLightGrey
              color: "transparent"
              radius: 8

              Column {
                  id: content
                  width: parent.width
                  spacing: 10
                  Text {
                      x: 10; y: 10
                      width: parent.width - 20
                      id: titleText
                      text: title;
                      color: heiaYellow
                      font.family: appItem.applicationFont
                      font.pixelSize: appItem.applicationFontSize
                      elide: Text.ElideRight
                  }
                  Row {                      
                      id: created
                      height: 30
                      x: 10
                      width: parent.width - 20
                      spacing: 10
                      Text {
                          id: authorText
                          text: author
                          color: heiaLightGrey
                          font.family: appItem.applicationFont
                          font.pixelSize: appItem.applicationFontSize - 10
                          wrapMode: Text.Wrap
                      }
                      Text {
                          horizontalAlignment: Text.AlignRight
                          id: pubDateText
                          text: pubDate.substring(0,pubDate.length-15)
                          color: heiaLightGrey
                          font.family: appItem.applicationFont
                          font.pixelSize: appItem.applicationFontSize - 10
                          font.italic: true
                          wrapMode: Text.Wrap
                      }
                  }
                  Text {
                      id: descriptionText
                      text: description
                      x: 10
                      width: parent.width - 20
                      height: 30
                      color: heiaLightGrey
                      font.family: appItem.applicationFont
                      font.pixelSize: appItem.applicationFontSize - 8
                      elide: Text.ElideRight
                  }
              }
          }
     }
 }
